package com.joe.xl.devcommon1.util.exception;

/**
 * @Author joexl <joe_xuli@163.com>
 * @Since 1.0
 * @Date 2020/11/10
 */
public class GlobalException extends RuntimeException {
    private final int code;

    public GlobalException(int code){
        this(code, "");
    }

    public GlobalException(int code, String msg) {
        this(code, msg, null);
    }

    public GlobalException(int code, String msg, Throwable cause) {
        super(msg, cause);
        this.code = code;
    }

    public int getCode() {
        return this.code;
    }

    public String toString() {
        return String.format(" code=%d, msg=%s ", this.code, this.getMessage());
    }
}
